import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            int[] array = new int[n];
            for (int i = 0; i < n; i++) {
                array[i] = in.nextInt();
            }
            int count = 1;
            int flag = 0;
            for (int i = 1; i < n; i++) {
                if (array[i - 1] < array[i]) {
                    if (flag == 0) {
                        flag = 1;
                    } else if (flag == -1) {
                        flag = 0;
                        count++;
                    }
                }
                if (array[i - 1] > array[i]) {
                    if (flag == 0) {
                        flag = -1;
                    } else if (flag == 1) {
                        flag = 0;
                        count++;
                    }
                }
            }
            System.out.println(count);
        }
    }

    public static void main2(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        //长度给n+1防止越界
        int[] array = new int[n + 1];
        for (int i = 0; i < n; i++) {
            array[i] = scan.nextInt();
        }
        int i = 0;
        int count = 0;
        while (i < n) {
            //进入非递减子序列
            if (array[i] < array[i + 1]) {
                while (i < n && array[i] <= array[i + 1]) {
                    i++;
                }
                count++;
                i++;
            } else if (array[i] == array[i + 1]) {
                i++;
            } else {
                while (i < n && array[i] >= array[i + 1]) {
                    i++;
                }
                count++;
                i++;
            }
        }
        System.out.println(count);
    }

    public static void main3(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String str = in.nextLine();
            String[] list = str.split(" ");
            StringBuffer stringBuffer = new StringBuffer();
            for(int  i = list.length-1; i >= 0; i--) {
                stringBuffer.append(list[i]).append(" ");
            }
            System.out.println(stringBuffer.toString());
        }
    }
    public static void reverse(char[] array,int start,int end) {
        while(start < end) {
            char tmp = array[start];
            array[start] = array[end];
            array[end] = tmp;
            start++;
            end--;
        }
    }
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String s = scan.nextLine();
        char[] ch = s.toCharArray();
        int len = ch.length;
        //1、整体进行了逆置
        reverse(ch,0,len-1);
        int i = 0;//遍历ch数组
        while( i < len ) {
            int j = i;
            while(j < len && ch[j] != ' ') {
                j++;
            }
            if(j < len) {
                reverse(ch,i,j-1);
                i = j+1;
            }else{
                reverse(ch,i,j-1);
                i = j;
            }
        }
        String str = new String(ch);
        System.out.println(str);
    }
}